<!DOCTYPE html>
<html lang="zh-CN">
    <head>
        <meta charset="UTF-8" />
        <title>23_基本数据类型-高级-string-toString</title>
    </head>
    <body>
        <script>
            // string
            var str = '123';
            console.log(typeof str);

            var strToString = str.toString();
            console.log(strToString);
            console.log(typeof strToString);

            // number
            var num = 123;
            console.log(typeof num);

            var numToString = num.toString();
            console.log(numToString);
            console.log(typeof numToString);


            // boolean
            var bool = false;
            console.log(typeof bool);

            var boolToString = bool.toString();
            console.log(boolToString);
            console.log(typeof boolToString);


            // undefined和null 没有toString方法
            
            // undefined
            // console.log(undefined.toString());

            // null
            console.log(null.toString());
        </script>
    </body>
</html>